window.onload=function(){
	//tohead的显示隐藏事件
	var body=document.getElementsByTagName('body')[0];
	console.log(document.documentElement.scrollTop);
	var vue=new Vue({
		el:'#tohead',
		data:{
			document:'',
			scrollTop:'',
		},
		watch:{
			scrollTop:function(now){
				if(now>0){
					tohead.style.display='none'
					console.log('now'+now)
				}
			}
		}
	});
	
	
	vue.document=document;
	vue.scrollTop=vue.document.documentElement.scrollTop;
	console.log(vue.scrollTop);
	console.log(vue.document);
	var tohead=document.getElementById('tohead');
	console.log(tohead);
	tohead.onclick=function(){
		console.log(vue.scrollTop);
	}
	
	var top_item_list=document.getElementById("top-menu").getElementsByClassName("item");
	
	//绑定黑色导航栏点击事件
	for(var i=0;i<top_item_list.length;i++)
	{
		top_item_list[i].onclick=function(){
			for(var j=0;j<top_item_list.length;j++)
			{
				top_item_list[j].setAttribute("class","item");
			}
			this.classList.add("choose");
		}
	}
	
	//绑定红色导航栏点击事件
	var bottom_item_list=document.getElementById("bottom-menu").getElementsByClassName("item");
	var bottom_menu_src=["recommend.html",'chart.html','','','',''];
	var iframe_height=["1700px",'4500px','','','',''];
	var iframe=document.getElementsByTagName("iframe")[0];
	for(var i=0;i<bottom_item_list.length;i++)
	{
		bottom_item_list[i].index=i;
		bottom_item_list[i].onclick=function(){
			for(var j=0;j<top_item_list.length;j++)
			{
				bottom_item_list[j].setAttribute("class","item");
			}
			this.classList.add("choose");
			iframe.setAttribute("src",bottom_menu_src[this.index]);
			console.log(iframe_height[this.index]);
			iframe.style.height=iframe_height[this.index];
		}
	}
	
}

